package com.itheima.d1_properties;

import java.io.File;
import java.io.FileReader;
import java.util.Properties;
import java.util.Set;

public class PropertiesTest1 {
    public static void main(String[] args) throws Exception{
        Properties properties = new Properties();
        System.out.println(properties);

        properties.load(new FileReader("Day19-properties-xml-log\\src\\users.properties"));
        System.out.println(properties);

        //根据键取值
        System.out.println(properties.getProperty("admin"));

        //遍历全部键取值
        Set<String> keys  = properties.stringPropertyNames();
        for (String key : keys) {
            String value = properties.getProperty(key);
            System.out.println(key + "==>" + value);
        }
        properties.forEach((k,v) -> System.out.println(k + "==>" + v));


    }
}
